// 点击切换
$(".heard li").on("click", function () {
    $(this).addClass("active").siblings().removeClass("active")
})
$(".h-new").on("click", function () {
    $(".r-new").show().siblings().hide()
})
$(".h-hot").on("click", function () {
    $(".r-hot").show().siblings().hide()
})

// 体验报告-最新
$.ajax({
    url: "http://127.0.0.1:3000/report/new",
    type: "get",
    success: function (res) {
        // console.log(res[0]);
        for (var i = 0; i < res.length;i++){
            $(".body .n-left ul").append(`
            <li>
            <div class="imgs">
                <img src=${res[i].img} alt="">
            </div>
            <div class="opacitys">
                <h3>${res[i].text}</h3>
                <div class="time">
                    <div class="t-left">
                        <span>
                            <span class="taiji"></span>
                        </span>
                        <span>${res[i].uName}</span>
                        <span>${res[i].endTime}</span>
                    </div>
                    <div class="t-right">
                        <span>
                            <img src="../img/css/img/xin.png" alt="">
                            ${res[i].num}
                        </span>
                        <span>
                            <img src="../img/css/img/reply.png" alt="">
                            ${res[i].apply}
                        </span>
                    </div>
                </div>
        </li>
        <li class="txt">关于格林威特空气净化器还有 4 篇报告，点击查看</li>
            `)
        }
    }
})
// 体验报告-最热
$.ajax({
    url: "../json/report.json",
    type: "get",
    success: function (res) {
        // console.log(res.hot);
        var newRes=res.hot
        for (var i = 0; i < newRes.length;i++){
            $(".body .r-hot .n-left ul").append(`
            <li>
            <div class="imgs">
                <img src=${newRes[i].img} alt="">
            </div>
            <div class="opacitys">
                <h3>${newRes[i].text}</h3>
                <div class="time">
                    <div class="t-left">
                        <span>
                            <span class="taiji"></span>
                        </span>
                        <span>${newRes[i].uName}</span>
                        <span>${newRes[i].endTime}</span>
                    </div>
                    <div class="t-right">
                        <span>
                            <img src="../img/css/img/xin.png" alt="">
                            ${newRes[i].num}
                        </span>
                        <span>
                            <img src="../img/css/img/reply.png" alt="">
                            ${newRes[i].apply}
                        </span>
                    </div>
                </div>
        </li>
        <li class="txt">关于格林威特空气净化器还有 4 篇报告，点击查看</li>
            `)
        }
    }
})